package com.lzugis.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.lzugis.common.R;
import com.lzugis.entity.SysUser;
import com.lzugis.service.IGisCapitalService;
import com.lzugis.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName SysUserController
 * @Author lzugis
 * @Date 2020/9/16 11:32
 **/
@Api(tags = "城市查询")
@RestController
@RequestMapping("city")
public class GisCapitalController {

    @Autowired
    private IGisCapitalService gisCapitalService;

    @ApiOperation("查询城市")
    @GetMapping("query")
    @PostMapping("query")
    public R selectByName(@RequestParam(required = false) Integer id, @RequestParam(required = false) String name) {
        EntityWrapper ew = new EntityWrapper<>();
        if(null != id) {
            ew.eq("id", id);
        }
        if(StringUtils.isNotBlank(name)) {
            ew.like("name", name);
        }
        return R.ok().put("data", gisCapitalService.selectList(ew));
    }

}
